package backend.parser;

import backend.core.dm.DataManager;
import backend.core.executor.Executor;
import backend.core.tbm.TableManager;
import backend.core.tm.TransactionManager;
import backend.core.tm.TransactionManagerImpl;
import backend.core.vm.VersionManager;

import java.nio.charset.StandardCharsets;

public class tbm_test {
    public static void main(String[] args) throws Exception {
        TransactionManagerImpl tm = TransactionManager.open("cun/tm");
        DataManager dm = DataManager.open("cun/dm", 1 << 20, tm);
        VersionManager vm = VersionManager.newVersionManager(tm, dm);
        TableManager tbm = TableManager.open("cun/", vm, dm);
        Executor executor = new Executor(tbm);
        //String ss=
        //String ss=" insert into student values 5 \"xiaohong\" 22";
//        byte b[]=ss.getBytes(StandardCharsets.UTF_8);
//        Object stat = Parser.Parse(b);
//        res = tbm.insert(xid, (Insert)stat);
        String ss = "create table tb name string,id int32 (index name id)";
        byte b[] = ss.getBytes(StandardCharsets.UTF_8);
        Object stat = Parser.Parse(b);
        System.out.println(stat);
        //tbm.create(1, (Create) stat);
    }
}
